package com.qianfeng.front.task;

import com.qianfeng.front.biz.IOrderBiz;

import java.util.Timer;
import java.util.TimerTask;

public class OrderTask extends TimerTask {

    //1: biz ; 2: oid ; 3: timer;

    private IOrderBiz orderBiz;
    private String oid;
    private Timer timer;

    public OrderTask(){

    }

    public OrderTask(IOrderBiz orderBiz, String oid, Timer timer) {
        this.orderBiz = orderBiz;
        this.oid = oid;
        this.timer = timer;
    }

    @Override
    public void run() {

        //设置订单为失效;
        orderBiz.updStatus(oid);

        //取消任务 并且从 作用于里面移除timer
        timer.cancel();
    }
}
